]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
swipeTracker: Flip pan gesture velocity in RTL locales
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 20 Nov 2025 14:51:23 +0000 (15:51 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 20 Nov 2025 14:51:23 +0000 (15:51 +0100)
Like the gesture delta, the final velocity needs to be flipped in
RTL locales, otherwise we end up cancelling out the gesture progress.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3967>

js/ui/swipeTracker.js

index 30afdef7b1dd9c7f940f8cfbf6608d4795acd670..45b23bfaea2eba99721e0e384f3f1d39ca75ae0f 100644 (file)
@@ -653,8 +653,8 @@ export const SwipeTracker = GObject.registerClass({
     _endPanGesture(panGesture) {
         const velocity = panGesture.get_velocity();
         const v = this.orientation === Clutter.Orientation.HORIZONTAL
-            ? -velocity.get_x()
-            : -velocity.get_y();
+            ? this._getGestureDirFactor() * velocity.get_x()
+            : this._getGestureDirFactor() * velocity.get_y();
 
         this._endGesture(v, this._distance, false);
     }
@@ -679,6 +679,14 @@ export const SwipeTracker = GObject.registerClass({
         this._endGesture(0, this._distance, false);
     }
 
+    _getGestureDirFactor() {
+        if (this.orientation === Clutter.Orientation.HORIZONTAL &&
+            Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
+            return 1;
+
+        return -1;
+    }
+
     /**
      * Confirms a swipe. User has to call this in 'begin' signal handler,
      * otherwise the swipe wouldn't start. If there's an animation running,